#include "ReportManager.hh"
#include <fstream>
#include <stdexcept>

namespace mini_bank {

void ReportManager::writeTransactionsToFile(
    const std::vector<Transaction>& txs,
    const std::string& filename)
{
    std::ofstream ofs(filename, std::ios::out);
    if (!ofs) {
        throw std::runtime_error("Failed to open file: " + filename);
    }
    for (auto& tx : txs) {
        ofs << tx.toString() << "\n";
    }
}

}